]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Add "precision" to boxpointer alignment
authorSardem FF7 <sardemff7.pub@gmail.com>
Wed, 9 Feb 2011 17:27:00 +0000 (18:27 +0100)
committerDan Winship <danw@gnome.org>
Wed, 16 Feb 2011 15:19:39 +0000 (10:19 -0500)
Allows the boxpointer arrow to be at a fixed percentage of the bubble

https://bugzilla.gnome.org/show_bug.cgi?id=642031

js/ui/appDisplay.js
js/ui/boxpointer.js
js/ui/dateMenu.js
js/ui/messageTray.js
js/ui/panel.js
js/ui/panelMenu.js
js/ui/statusMenu.js

index e39d399df3bd275912817436303450d388632e61..a2286d0110f8aea7512f93f029e6f89ae4350a78 100644 (file)
@@ -505,7 +505,7 @@ AppIconMenu.prototype = {
         if (St.Widget.get_default_direction() == St.TextDirection.RTL)
             side = St.Side.RIGHT;
 
-        PopupMenu.PopupMenu.prototype._init.call(this, source.actor, St.Align.MIDDLE, side, 0);
+        PopupMenu.PopupMenu.prototype._init.call(this, source.actor, 0.5, side, 0);
 
         this._source = source;
 
index 887f4a78312aa89c60b423bbf07dd915c2c45105..99de6f18c00925b5af5f882c623fa3bc097c67f8 100644 (file)
@@ -320,9 +320,11 @@ BoxPointer.prototype = {
         // separated from its sourceActor
         let primary = global.get_primary_monitor();
         let themeNode = this.actor.get_theme_node();
-        let halfBorder = themeNode.get_length('-arrow-border-width') / 2;
-        let halfBase = themeNode.get_length('-arrow-base') / 2;
+        let borderWidth = themeNode.get_length('-arrow-border-width');
+        let arrowBase = themeNode.get_length('-arrow-base');
         let borderRadius = themeNode.get_length('-arrow-border-radius');
+        let margin = (4 * borderRadius + borderWidth + arrowBase);
+        let halfMargin = margin / 2;
 
         let resX, resY;
 
@@ -346,17 +348,7 @@ BoxPointer.prototype = {
         switch (this._arrowSide) {
         case St.Side.TOP:
         case St.Side.BOTTOM:
-            switch (alignment) {
-            case St.Align.START:
-                resX = sourceCenterX - (halfBase + borderRadius + halfBorder);
-                break;
-            case St.Align.MIDDLE:
-                resX = sourceCenterX - (natWidth / 2);
-                break;
-            case St.Align.END:
-                resX = sourceCenterX - natWidth + (halfBase + borderRadius + halfBorder);
-                break;
-            }
+            resX = sourceCenterX - (halfMargin + (natWidth - margin) * alignment);
 
             resX = Math.max(resX, primary.x + 10);
             resX = Math.min(resX, primary.x + primary.width - (10 + natWidth));
@@ -365,17 +357,7 @@ BoxPointer.prototype = {
 
         case St.Side.LEFT:
         case St.Side.RIGHT:
-            switch (alignment) {
-            case St.Align.START:
-                resY = sourceCenterY - (halfBase + borderRadius + halfBorder);
-                break;
-            case St.Align.MIDDLE:
-                resY = sourceCenterY - (natHeight / 2);
-                break;
-            case St.Align.END:
-                resY = sourceCenterY - natHeight + (halfBase + borderRadius + halfBorder);
-                break;
-            }
+            resY = sourceCenterY - (halfMargin + (natHeight - margin) * alignment);
 
             resY = Math.max(resY, primary.y + 10);
             resY = Math.min(resY, primary.y + primary.height - (10 + natHeight));
index f22cfd5f3ecbecee005b4cd8c09e70102f0c1959..e37b4afef670f72c44d0fc0524c03c6d141642cb 100644 (file)
@@ -56,7 +56,7 @@ DateMenuButton.prototype = {
         //this._eventSource = new Calendar.FakeEventSource();
         this._eventSource = new Calendar.EvolutionEventSource();
 
-        PanelMenu.Button.prototype._init.call(this, St.Align.START);
+        PanelMenu.Button.prototype._init.call(this, 0.0);
 
         this._clock = new St.Label();
         this.actor.set_child(this._clock);
index 3450b199ad743f20b50ed7cbf818d9cac31bfe2d..38598fb300cb03f1c5dd0abaa02af7bfd4f67664 100644 (file)
@@ -1802,7 +1802,7 @@ MessageTray.prototype = {
         if (!this._clickedSummaryItem)
             return;
 
-        this._summaryNotificationBoxPointer.setPosition(this._clickedSummaryItem.actor, 0, St.Align.MIDDLE);
+        this._summaryNotificationBoxPointer.setPosition(this._clickedSummaryItem.actor, 0, 0.5);
     },
 
     _unsetClickedSummaryItem: function() {
index 5389b882045d3b3b17f461fa7150309645e1cade..1c32e86195f299eea385f490766698562c69d887 100644 (file)
@@ -195,7 +195,7 @@ AppMenuButton.prototype = {
     __proto__: PanelMenu.Button.prototype,
 
     _init: function() {
-        PanelMenu.Button.prototype._init.call(this, St.Align.START);
+        PanelMenu.Button.prototype._init.call(this, 0.0);
         this._metaDisplay = global.screen.get_display();
         this._startingApps = [];
 
index 6248264e333913ad01a53a51046e411bc8325b0f..a3e9e8ccf83e9563abfa93169ab7f0f1e5f2c58e 100644 (file)
@@ -68,7 +68,7 @@ SystemStatusButton.prototype = {
     __proto__: Button.prototype,
 
     _init: function(iconName,tooltipText) {
-        Button.prototype._init.call(this, St.Align.START);
+        Button.prototype._init.call(this, 0.0);
         this._iconActor = new St.Icon({ icon_name: iconName,
                                         icon_type: St.IconType.SYMBOLIC,
                                         style_class: 'system-status-icon' });
index e09c851e996eb70dde1d2d095b62f4a20fe5c452..ecc12b0440c56014fbfb14d6db64d0cf2c517139 100644 (file)
@@ -27,7 +27,7 @@ StatusMenuButton.prototype = {
     __proto__: PanelMenu.Button.prototype,
 
     _init: function() {
-        PanelMenu.Button.prototype._init.call(this, St.Align.START);
+        PanelMenu.Button.prototype._init.call(this, 0.0);
         let box = new St.BoxLayout({ name: 'panelStatusMenu' });
         this.actor.set_child(box);